load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test", "rust_test_suite")

package(default_visibility = ["//visibility:public"])

DEPENDENCIES = [
    # Keep sorted.
    "//rs/config",
    "//rs/http_endpoints/async_utils",
    "//rs/monitoring/metrics",
    "@crate_index//:axum",
    "@crate_index//:prometheus",
    "@crate_index//:slog",
    "@crate_index//:thiserror",
    "@crate_index//:tokio",
    "@crate_index//:tokio-io-timeout",
    "@crate_index//:tower",
]

DEV_DEPENDENCIES = [
    # Keep sorted.
    "//rs/test_utilities/logger",
    "@crate_index//:reqwest",
]

rust_library(
    name = "metrics",
    srcs = glob(["src/**"]),
    crate_name = "ic_http_endpoints_metrics",
    version = "0.9.0",
    deps = DEPENDENCIES,
)

rust_test(
    name = "metrics_test",
    size = "small",
    crate = ":metrics",
    deps = DEPENDENCIES + DEV_DEPENDENCIES,
)

rust_test_suite(
    name = "metrics_integration",
    size = "small",
    srcs = glob(
        ["tests/**"],
    ),
    proc_macro_deps = [],
    deps = [":metrics"] + DEPENDENCIES + DEV_DEPENDENCIES,
)
